<div >
    <div ng-if="!vm.hasPermissionProduct">
        您无权访问此页面！
    </div>
    <div class="row" ng-if="vm.hasPermissionProduct">
        <span class="col-sm-1">
            <div ng-click="vm.mode='add';vm.currentProduct={};" style="background:{{vm.mode=='add'?'green':'transparent'}}">新建</div>
            <div ng-repeat="product in vm.products" ng-click="vm.setCurrentProduct(product);vm.mode='edit';" style="background:{{vm.currentProduct==product?'green':'transparent'}}">
                {{product.id}},{{product.name}}<p/>
                {{product.number}},{{product.price|currency:'￥'}}
            </div>
        </span>
        <span class="col-sm-10" >
            <div ng-show="vm.currentProduct != undefined">
                <div class="row">
                    <div class="col-sm-3">
                        名称：
                        <input type="text" ng-model="vm.currentProduct.name"><p/>
                        数量：
                        <input type="text" ng-model="vm.currentProduct.number"><p/>
                        价格：
                        <input type="text" ng-model="vm.currentProduct.price"><p/>
                        原价：
                        <input type="text" ng-model="vm.currentProduct.old_price"><p/>
                        概述：
                        <textarea  ng-model="vm.currentProduct.summary"></textarea><p/>
                        详细信息：
                        <textarea maxlength="2000" ng-model="vm.currentProduct.comment"></textarea>
                        <a class="btn btn-default" ng-click="vm.saveEdit();">保存</a>
                        <a ng-show="vm.mode=='edit'" class="btn btn-default" ng-click="vm.remove();">删除</a>
                    </div>
                    <div class="col-sm-9">
                        <p ng-bind-html="vm.currentProduct.comment | to_trusted"></p>
                    </div>
                </div>
                <p/>
                <div class="row">
                    <span class="col-sm-3" ng-repeat="image in vm.currentProduct.images">
                        <img style="width:30%;" ng-src="{{image.url}}" ><p/>
                        <a class="btn btn-default" ng-click="vm.removeImage(image);">删除</a>
                    </span>
                </div>
                <div ng-show="vm.mode=='edit'">
                    <ng-include src="'/template/component/UploadFile.html'"></ng-include>
                    <a class="btn btn-default" ng-click="vm.addImages()">添加</a>
                </div>
            </div>
        </span>
        <span class="col-sm-1" ng-show="vm.mode=='edit'">
            <div ng-repeat="category in vm.getValidCategories()">
                {{category.id}}<p/>
                {{category.name}}
                <a ng-click="vm.setCategory(category)">设置</a>
            </div>
        </span>
    </div>
</div>